home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
extras
/
programm
/
gemfsc20
/
gemfsc20.lzh
/
GEMFUNCS
/
WCSCRCAL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-07
|
1KB
|
52 lines
/*****************************************************************************
* WCSCRCAL.C - Calc size and position of a scroller.
*
* Note that this function's real name is wc_scrcal as far as the
* linker is concerned, since HSC has a 8-char limit. scrcal is a
* bit too cryptic, so a macro in gemfast.h remaps the name to
* wc_scroll_calc for us.
****************************************************************************/
#include "gemfintl.h"
void wc_scroll_calc(curline, datalines, windowlines,
pslidesize, pslidepos)
short curline;
short datalines;
short windowlines;
short *pslidesize;
short *pslidepos;
/**************************************************************************
* calc the size and position of a slider (eg, a window scroll slider).
*************************************************************************/
{
short slsize = 1000;
short slpos = 1;
if (windowlines >= datalines) {
goto ERROR_EXIT;
}
slsize = (short)((1000L * windowlines) / datalines);
slpos = (short)((1000L * curline) / (datalines - windowlines));
if (slsize < gl_hchar) {
slsize = -1;
} else if (slsize > 1000) {
slsize = 1000;
}
if (slpos < 1) {
slpos = 1;
} else if (slpos > 1000) {
slpos = 1000;
}
ERROR_EXIT:
*pslidesize = slsize;
*pslidepos = slpos;
}